import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'

type CusRouteRecordRaw = RouteRecordRaw & {
  cmpName: string
}

const routes: CusRouteRecordRaw[] = [
  {
    path: '/',
    name: 'home',
    cmpName: '主页',
    component: () => import('../views/HomeView.vue'),
  },
  {
    path: '/about',
    name: 'about',
    cmpName: '关于页',
    // route level code-splitting
    // this generates a separate chunk (About.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('../views/AboutView.vue'),
  },
  {
    path: '/user/roleView',
    name: 'roleView',
    cmpName: '用户角色',
    component: () => import('../views/user/role/IndexView.vue'),
  },
  {
    path: '/user/settingView',
    name: 'settingView',
    cmpName: '用户设置',
    component: () => import('../views/user/setting/IndexView.vue'),
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routes,
})

export default router

export { routes }
